package leetcode.tree;

import leetcode.tree.common.TreeNode;

/**
 * @author mazouri
 * @create 2021-05-03 23:16
 * <p>
 * https://leetcode-cn.com/problems/same-tree/
 */
public class _100_isSameTree {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if (q == null && q == null) return true;
        if (q == null || p == null) return false;
        if (p.val != q.val) return false;
        return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }
}
